package com.ktgj.service.controller;

import java.util.HashMap;
import java.util.List;
import java.io.IOException;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ktgj.common.core.utils.StringUtils;
import com.ktgj.service.domain.VipImage;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.service.domain.ViphallImagedesc;
import com.ktgj.service.service.IViphallImagedescService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;

/**
 * 贵宾厅图文描述Controller
 * 
 * @author ruoyi
 * @date 2021-09-03
 */
@ControllerAdvice
@RestController
@RequestMapping("/imagedesc")
public class ViphallImagedescController extends BaseController
{
    @Autowired
    private IViphallImagedescService viphallImagedescService;

    /**
     * 查询贵宾厅图文描述列表
     */
    //@PreAuthorize(hasPermi = "service:imagedesc:list")
    @GetMapping("/list")
    public TableDataInfo list(ViphallImagedesc viphallImagedesc)
    {
        startPage();
        List<ViphallImagedesc> list = viphallImagedescService.selectViphallImagedescList(viphallImagedesc);
        return getDataTable(list);
    }

    /**
     * 导出贵宾厅图文描述列表
     */
    //@PreAuthorize(hasPermi = "service:imagedesc:export")
    @Log(title = "贵宾厅图文描述", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ViphallImagedesc viphallImagedesc) throws IOException
    {
        List<ViphallImagedesc> list = viphallImagedescService.selectViphallImagedescList(viphallImagedesc);
        ExcelUtil<ViphallImagedesc> util = new ExcelUtil<ViphallImagedesc>(ViphallImagedesc.class);
        util.exportExcel(response, list, "贵宾厅图文描述数据");
    }

    /**
     * 获取贵宾厅图文描述详细信息
     */
    //@PreAuthorize(hasPermi = "service:imagedesc:query")
    @GetMapping(value = "/{imagedescId}")
    public AjaxResult getInfo(@PathVariable("imagedescId") Long imagedescId)
    {
        return AjaxResult.success(viphallImagedescService.selectViphallImagedescById(imagedescId));
    }

    /**
     * 新增贵宾厅图文描述
     */
    //@PreAuthorize(hasPermi = "service:imagedesc:add")
    @Log(title = "贵宾厅图文描述", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ViphallImagedesc viphallImagedesc)
    {
        return toAjax(viphallImagedescService.insertViphallImagedesc(viphallImagedesc));
    }

    /**
     * 修改贵宾厅图文描述
     */
    //@PreAuthorize(hasPermi = "service:imagedesc:edit")
    @Log(title = "贵宾厅图文描述", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ViphallImagedesc viphallImagedesc)
    {
        return toAjax(viphallImagedescService.updateViphallImagedesc(viphallImagedesc));
    }

    /**
     * 删除贵宾厅图文描述
     */
    //@PreAuthorize(hasPermi = "service:imagedesc:remove")
    @Log(title = "贵宾厅图文描述", businessType = BusinessType.DELETE)
	@DeleteMapping("/{imagedescIds}")
    public AjaxResult remove(@PathVariable Long[] imagedescIds)
    {
        return toAjax(viphallImagedescService.deleteViphallImagedescByIds(imagedescIds));
    }
}
